package com.skt.common_hr.teamworktime_sac.model
{
	import com.skt.common_hr.common.puremvc.CommonProxy;
	
	import mx.rpc.events.FaultEvent;
	import mx.rpc.events.ResultEvent;

	public class DelWorkTimeProxy extends CommonProxy
	{
		public static const NAME:String = "DelWorkTimeProxy";
		
		public static const DELETE_WORKTIME_COMPLETE:String = "deleteWorkTimeComplete";
		public static const DELETE_WORKTIME_FAILED:String = "deleteWorkTimeFailed";
		
		/**
		 * 생성자
		 * 
		 * @param
		 * @return void
		 */
		public function DelWorkTimeProxy(data:Object=null)
		{
			super(NAME, data);
		}
		
		public function deleteWorkTime(key:String):void
		{
			var param:Object = new Object;
			var tables:Object = new Object;
			tables["ITAB"] = [{GWAREKEY:key}];
			saveData("Z_HR_0069", param, tables, result, fault);
		}
		
		///////////////////////////////////////////////////////////////////////////////////////////////////
		//
		//	Event Listeners
		//
		///////////////////////////////////////////////////////////////////////////////////////////////////
		/**
		 * 서버에서 정상적으로 리턴된 결과를 처리
		 * 
		 * @param
		 * @return void
		 */
		public function result(event:ResultEvent):void
		{
			if(retCode==0) {  
				facade.sendNotification(DELETE_WORKTIME_COMPLETE, this);
			}
			else {
				facade.sendNotification(DELETE_WORKTIME_FAILED, this);
			}
		}
		
		/**
		 * 서버에서 오류가 발생했을 처리
		 * 
		 * @param
		 * @return void
		 */
		private function fault(event:FaultEvent):void
		{
			facade.sendNotification(DELETE_WORKTIME_FAILED, this);
		}
	}
}